<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xmlns:cache="http://www.springframework.org/schema/cache"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
	http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
	http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
	http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
	http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
	">
	
	<!-- Root Context: defines shared resources visible to all other web components -->
	<cache:annotation-driven />

<!-- 
	<bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
		<property name="caches">
			<set>
				<bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean" name="testCache" />
				<bean class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean" name="hotelRmCache" />
			</set>
		</property>
	</bean>
 -->
 
  <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cacheManager-ref="ehcache"/>
  <bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:configLocation="classpath:ehcache.xml" p:shared="true"/> 
	
	<bean class="org.apache.commons.dbcp.BasicDataSource" id="dscrs">
		<property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
		<property name="url"
			value="jdbc:jtds:sqlserver://172.23.100.30/CRS" />
		<property name="username" value="sa" />
		<property name="password" value="hotelrj" />
		<property name="initialSize" value="1000"></property>
	</bean>
	
	<bean class="com.mchange.v2.c3p0.ComboPooledDataSource" id="ds" destroy-method="close" lazy-init="false">
		<property name="driverClass" value="net.sourceforge.jtds.jdbc.Driver" />
		<property name="jdbcUrl" value="jdbc:jtds:sqlserver://172.23.100.30/CRS" />
		<property name="user" value="sa" />
		<property name="password" value="hotelrj" />
		<property name="initialPoolSize" value="1000" />
		<property name="minPoolSize" value="100" />
		<property name="maxPoolSize" value="500" />
		<property name="acquireIncrement" value="2" />
		<property name="maxIdleTime" value="3600" />
		<property name="idleConnectionTestPeriod"  value="1800"/> 
        <property name="testConnectionOnCheckin" value="true" />
        <property name="automaticTestTable" value="TestTable" />
        <property name="testConnectionOnCheckout" value="false" />	
	</bean>

<!-- 
	<bean id="jdbc_TransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="ds"></property>
	</bean>
	

	<tx:advice id="txAdvice" transaction-manager="jdbc_TransactionManager">
		<tx:attributes>
			<tx:method name="insert*" propagation="REQUIRED" isolation="READ_COMMITTED" />
			<tx:method name="update*" propagation="REQUIRED" isolation="READ_COMMITTED"/>
			<tx:method name="del*" propagation="REQUIRED" isolation="READ_COMMITTED"/>
			<tx:method name="*" propagation="SUPPORTS" read-only="false" isolation="READ_COMMITTED"/>
		</tx:attributes>
	</tx:advice>		

	<aop:config>
		<aop:pointcut id="txMethod" expression="execution(* com.homeinns.dao.*.*(..))" />
		<aop:advisor advice-ref="txAdvice" pointcut-ref="txMethod" />
	</aop:config>
 -->
	<bean class="org.springframework.jdbc.core.JdbcTemplate" id="jdbcTemplate">
		<constructor-arg ref="dscrs" /> 
	</bean>
	
	<bean id="hotelRmDao" class="com.homeinns.dao.HotelRmDao"></bean>
	<bean id="hotelDao" class="com.homeinns.dao.HotelDao"></bean>
	<bean id="testCacheDao" class="com.homeinns.dao.TestCacheDao"></bean>
	<bean id="frequencePersonDao" class="com.homeinns.dao.FrequencePersonDao"></bean>
	<bean id="hotelRmService" class="com.homeinns.service.HotelRmService"></bean>
	<bean id="hotelService" class="com.homeinns.service.HotelService"></bean>
	
	
	<bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
           <property name="classesToBeBound">
                <list>
                    <value>com.homeinns.model.FreqencePersonList</value>
                	<value>com.homeinns.model.FrequencePerson</value>
                	<value>com.homeinns.model.HotelRmList</value>
                	<value>com.homeinns.model.HotelRm</value>
                    <value>com.homeinns.model.Employee</value>
                    <value>com.homeinns.model.EmployeeList</value>
                </list>
            </property>
     </bean> 
	<context:component-scan base-package="com.homeinns"/>
	
</beans>
